package cn.szh.dao;

import cn.szh.domain.Order;
import cn.szh.domain.Product;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import org.springframework.stereotype.Repository;

import java.util.List;



public interface OrderDao {
    @Select("select * from orders")
    @Results({
            @Result(id=true,column="id",property="id"),
            @Result(column="orderNum",property="orderNum"),
            @Result(column="orderTime",property="orderTime"),
            @Result(column="orderStatus",property="orderStatus"),
            @Result(column="peopleCount",property="peopleCount"),
            @Result(column="payType",property="payType"),
            @Result(column="orderDesc",property="orderDesc"),
            @Result(property = "product",column = "productId",
                    javaType = Product.class,one = @One(select = "cn.szh.dao.ProductDao.findById")),
    })
    List<Order> findAll();
}
